<template>
  <span>
    <template v-if="hasPermission">
      <slot></slot>
    </template>
    <template v-else></template>
  </span>
</template>

<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'
import { UserModule } from '@/store/modules/user'

@Component({})
export default class extends Vue {
  @Prop({ required: true }) private permissionKey!: string
  get hasPermission(): boolean {
    return (UserModule.buttonPermission || []).includes(this.permissionKey)
  }
}
</script>
